<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../style.css" type="text/css" />
</head>
<?php
		include_once "../inc/docroot.php";
		include_once PATH."inc/class.autores.inc.php";
		$autores = new autores($db);
		if(isset($_GET['smtp']))$smtp_id = $_GET['smtp'];
		if(isset($_GET['edit']))$edit = $_GET['edit'];
		if(isset($_GET['delete']))$delete = $_GET['delete'];

?>
<body>
<div>
   <div class="autores_header">
<?php
       if(  !empty($_POST['host']) && !empty($_POST['port']) && !empty($_POST['name']) && isset($smtp_id) && isset($edit) && $edit == 1) {
        	echo "<br /><br />";
			echo $autores->editsmtp($smtp_id);
			?>
			<script>
			window.opener.location.reload();
			window.close();
            </script>
            <?php
	   }
	   else if( !empty($_POST['host']) && !empty($_POST['port']) && !empty($_POST['name'])) {
        	echo "<br /><br />";
			echo $autores->addsmtp();
			?>
			<script>
			window.opener.location.reload();
            </script>
            <?php
	   }
	   else {
    		echo "<br />";
    		echo "<br />";
   			echo "<label>Please fill all the fields.</label>";
		}
		echo "<br />";
		echo "<br />";
	   
		if(isset($smtp_id) && isset($edit) && $edit == 0){
			echo "<label> EDIT SMTP: " .$smtp_id."</label>";
		}
		else {
			echo "<label> ADD A NEW SMTP </label>";
		}
?>
	  </div>
  <form method="post" action="addnewsmtp.php<?php if(isset($smtp_id) && isset($edit)) echo "?smtp=".$smtp_id."&edit=1";?>" name="addsmtpform" id="addsmtpform">
    <div style="font-size:9px;" align="center">
      <br />
      <br />
      <input type="text" name="name" id="name" style="text-align:center"/>
      <label for="name">Name</label>
      <br />
      <br />
      <input type="text" name="host" id="host" style="text-align:center"/>
      <label for="host">Host</label>
      <br />
      <br />
      	<input type="text" name="port" id="port" width="60" style="width: 60px; text-align:center"/>
      	<label for="port" width="60" style="width: 60px">Port</label>
      <br />
      <br />
      <select name="auth" id="auth" width="75" style="width: 75px; height:20px; font-size:15px;" height="20">
  			<option value="true">TRUE</option>
  			<option value="false">FALSE</option>
      </select></br>
      <label for="auth">Auth</label>
      <br />
      <br />
 	  <select name="secure" id="secure" width="75" style="width: 75px; height:20px; font-size:15px;" height="20">
  			<option value="ssl">SSL</option>
  			<option value="tls">TLS</option>
      </select></br>
      <label for="secure">Secure</label>
      <!--
      <br />
      <br />
       	<input type="text" name="per_hour" id="per_hour" width="60" style="width: 60px; text-align:center"/>
      	<label for="per_hour" width="60" style="width: 60px">Mails/HOUR</label>
      -->
      <br />
      <br />
        <input type="text" name="per_day" id="per_day" width="60" style="width: 60px; text-align:center"/>
      	<label for="per_day" width="60" style="width: 60px">Mails Send/Day</label>
      <br />
      <br />
      <br />
      <br />
      <input type="submit" name="addsmtpinput" id="addsmtpinput" value="Save SMTP" class="btn btn--blue btn--m" />
    </div>
  </form>
</div>
</body>
